Let's say I have a parametrized ellipse
$$x (t) = a \cos(t) \cos(r) - b \sin(t) \sin(r)$$
$$y (t) = a \cos(t) \sin(r) + b \sin(t) \cos(r)$$
Where $r$ is the rotation around the axis and $t \in [0,2\pi]$ the parameter. How would I find the $a$ and $b$ such as the ellipse is largest, area wise, inside a rectangle of $w$ width and $h$ height?
Thanks math gurus!
Update: Both ellipse and rectangle are centered on $(0,0)$. Rotation $r \in [0,\pi/2]$ is elevation from the $x$ axis.