Graphics programmer here. Many times drawing a square isn't a great option in games; particularly when there are many. The usual approach is blitting them squares from raster/image data which is a mere copy of texture data into frame buffer. If you're experimenting with Bresenham's line drawing or writing a game is the right probing question here.
If you don't know how to draw a square then it's probably not the time to worry about that level of efficiency. Figure out the method that keeps your development and learning pace as high as possible.