I've struck up against what feels like a simple problem, but one I - for the life of me- can't figure out.
If you have a rectangle, with sides $a$ and $b$, it's exactly $b$ wide. However, when you rotate it, the space it takes up in it's width (in the $x$ dimension) get more, until the space needed is as wide as the hypothenuse at a rotation of 45°. So far so intuitive.
However, how can I calculate just how much I need to rotate said rectangle, to take up exactly a given space?
In the image below, you can see I have a rectangle that $120$mm wide and $40$mm tall. How much do I need to rotate it, so that it's "width" is exactly $120$mm?

As suggested in the comments we need that
$$120 \cos \alpha +40 \cos (90-\alpha)=120$$
$$120 \cos \alpha +40 \sin \alpha=120$$
$$3 \cos \alpha + \sin \alpha=3$$
which leads to $\alpha =0$ (trivial solution) or $\alpha = 2\arctan \frac13\approx 36,9°$