I created a rectangle with four 2D-vertices using glVertex2D. If i put a glRotatef-command before glBegin(GL_QUADS), the rectangle gets rotated but does not keep its aspect ratio (only if my window is a square…).
Settings the perspective the following way…

For one thing, make sure you move the camera back.
Right now the camera is at 0,0,0 (unless you do some glTranslate after the modelview loadidentity), and your vertices are at z=0.

Also, (but that is only a potential render quality issue), you should set zNear to something bigger than 0.

That’s simple.
The OpenGL defaults for modelview and projection matrices is the identity. An identity in the projection matrix is an orthographic projection of the unit cube with radius 1.0 around the origin. (Check the math in the OpenGL Programming Guide appendix F).
When your window is square, the OpenGL projection maps to square pixels.
What you need is to setup the glOrtho to have the aspect ratio of the window.

Looks like this in GLUT

void reshape(int w, int h)
{
GLdouble aspectRatio = 1.0;
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w > 0 && h > 0)
{
aspectRatio = (GLdouble) w / (GLdouble) h;
}
glOrtho(-aspectRatio, aspectRatio, -1.0, 1.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc, char** argv)
{
...
glutReshapeFunc(reshape);
...
}