You could add some scaling (ofScale(scale)) too between the Push/Pop matrix methods.
You could add another variable for the width/height shape, and then to fill a surface with aligned shapes…(using a for loop maybe)
And adding a bit to the post by moebiussurfing, this particular shape could be drawn by a loop which uses the pythagorean theorem to calculate the side of a square from the previous one, and which also uses ofRotateRad() to rotate the frame so that either a square or a diamond shape is drawn.
Sometimes its easier (math wise) to draw a shape around the origin (0, 0), and then use ofTranslate() to move the frame so that the shape ends up at the correct position on the screen. oF also has 2 rectangle modes (corner and center), with OF_RECTMODE_CORNER as default. Sometimes setting the mode to the center can be helpful.