glrotate a rectangle in place?

how can I rotate a graphic like I can a 3dmodel?

glPushMatrix();

glRotate(45*sinf(someTimer)), 0, 1, 0);
ofSetRectmode(1);
ofRect(centerx, centery, 10,10);

glPopMatrix();

This does not rotate around the centerpoint of the rectangle. How do I set the center point in the opengl context?

I figured it out:
glPushMatrix():
glRotate(45*sinf(someTimer)), 0, 1, 0);
glPushMatrix();

ofSetRectmode(1);
ofRect(centerx, centery, 10,10);

glPopMatrix();

glPopMatrix();