I’ve got a 2D openGL window. I want to draw some rectangles (actually perfect squares), but they need to be rotated. I’m having trouble with this. This is what I’ve tried:

//rotate the window

glRotated(dblRotationAngle, 0.0, 0.0, 1.0);

//draw the rectangle

glRectd(x1, y1, x2, y2);

//restore original amount of rotation

glRotated(-dblRotationAngle, 0.0, 0.0, 1.0);

The problem is trying to determine what the rectangle vertices should be, now that the window is rotated. What would make this REALLY REALLY EASY is if there was a rectangle drawing function where only the center point of the square was passed in, as well as the length of each side, like this:

glRect(X,Y, sideLength);

Is there such a function? If not, how do I determine the two vertices of my rectangle once my window has been rotated?

Thanks very much.