# calculate angle of rectangle where most upper corner is in vertical line with lowest

I'm developing a website. For design I need to calculate the angle of a rectangle which is needed to get the top left corner in a vertical line with the bottom right one.

Example: I've a square/rectangle with the dimensions 10×10 cm (or inch/pixels, doesn't matter). To get the top left corner in the same vertical line as the bottom right corner, you need to rotate it 45 degrees.

How do I calculate that angle? When i've the dimensions 312×64 (Height × Width) cm for instance.

I've tried with Angle = Width × (90 / (Width + Height)). But the result was incorrect.

I'm absolutely not a mathematician, so i'm sorry if this question is almost to simple to answer. Here an image describing the problem.

• what is the center of rotation (i.e. point that does not move)? Sep 20, 2017 at 19:07

Rotate clockwise the rectangle around the intersection point of the diagonals of an angle $$\alpha=\arctan\left(\frac{64}{312}\right)$$ 