How to calculate width and height of a 45° rotated ellipse bounded by a square? I'm coming from a programming background so I apologies if this is blindingly simple or I misuse terms. I have an ellipse bounded by a square. For simplicity the centre of the square and ellipse is the origin (0,0) while the square is 2 width and 2 height.
The ellipse is rotated -45° or +45° (angle in image) and I can easily work this out. The ellipse touches all sides of the square, and I also know the intersection points. In the image A is the distance between the corner and the intersection while B is the length of the long section (the other points are symmetric).

What is the width and height, as described in the image, of the ellipse?

Consider an square formed by the sides of $\pm x\pm y=m$ (i.e. side length $m\sqrt2$). 
Now find an ellipse which touches the square. Consider the top right quadrant. Edge of square is $$L: \quad x+y=m$$Assume point of tangency is $P(h,k)$. 
Ellipse, $E$:
$$\begin{align}
\frac {x^2}{a^2}+\frac {y^2}{b^2}&=1\\
\frac {dy}{dx}&=-\frac {b^2x}{a^2y}=-\frac {b^2h}{a^2k}=-1\quad\text{at }P\\
\frac h{a^2}&=\frac k{b^2}
\end{align}$$
$P$ lies on L, hence $h+k=m$, which gives
$$\begin{align}
h&=\left(\frac {m}{a^2+b^2}\right)a^2\\
k&=\left(\frac {m}{a^2+b^2}\right)b^2
\end{align}$$
$P$ lies on $E$, hence
$$\begin{align}
\left(\frac {m}{a^2+b^2}\right)^2\left[\frac {(a^2)^2}{a^2}+\frac {(b^2)^2}{b^2}\right]&=1\\
m&=\sqrt{a^2+b^2}
\end{align}$$
This gives 
$$\begin{align}
h&=\frac {a^2}m\\
k&=\frac {b^2}m\end{align}$$
$P$ divides edge of square into side lengths $$B=h\sqrt{2}=\frac {a^2\sqrt{2}}m\\ A=k\sqrt{2}=\frac {b^2\sqrt{2}}m$$ 
In the question posted, side length of square is $2$, hence $m=\sqrt{2}$, which gives
$$A=b^2\\
B=a^2$$
"Height" (major axis) and "Width" (minor axis) of $E$ are  given by
$$\text{Height (major axis)=}\color{red}{2a=2\sqrt{B}}\\
\text{Width (minor axis)=}\color{red}{2b=2\sqrt{A}}$$

Note
$\hspace{3cm}$ 
From this solution to another recent MSE question, note that the ellipse 
$$\frac{x^2}{u}+\frac {y^2}{1-u}=1$$
has a nice property in that its point of tangency with the  line $L: x+y=1$ is  $(u,1-u)$ which divides the line segment $V(0,1), H(1,0)$ on $L$ in the ratio $u:1-u$. Note that $0<u<1$. The line segment $VH$ has length $\sqrt2$. The semi-major and semi-minor axes of the ellipse are $\sqrt{u}, \sqrt{1-u}$ respectively. 
