Grabbed a pencil, piece of paper, and Maple and solved it by myself.
var eqRoot:Number = -Math.sqrt(newBottomWidth*newBottomWidth*oldHeight*oldHeight - newHeight*newHeight*oldWidth*oldWidth);
var focalLength:Number = Math.abs(eqRoot/(newBottomWidth - oldWidth));
var angle:Number = Math.atan2(eqRoot/(newBottomWidth*oldHeight), newHeight*oldWidth/(newBottomWidth*oldHeight));
var angleDeg:Number = angle*180/Math.PI;
If you begin with a horizontal object whose initial dimensions are $L_x$ and $L_y$ (before scaling), then the offset between blue and red text should be
$$
\begin{align}
&\Delta x={K_x-1\over2}L_x(1-\cos\alpha)+{K_y-1\over2}L_y\sin\alpha,\cr
&\Delta y=-{K_y-1\over2}L_y(1-\cos\alpha)+{K_x-1\over2}L_x\sin\alpha,\cr
\end{align}
$$
where $\alpha$ is the rotation angle with respect to the horizontal and $K_x$, $K_y$ are the scaling factors.
The sign of $\Delta x$ and $\Delta y$ depends on how you measure $\alpha$, so you may need to find the correct sign by trial and error. Hope that helps.
EDIT
To show how those formulas can be derived, consider the black rectangle in the diagram below. Scaling it (with respect to up-left vertex $P$) and then rotating around the center $O'$ of the scaled rectangle yields a final brown rectangle, whose up-left vertex is $P'$.
If the black rectangle is first rotated around its center $O$ and then scaled with respect to $P''$, then we get instead the blue rectangle below. We are interested in finding the "offset" vector $\vec{P'P''}$.
If we denote by $R$ the rotation operator
($R(x,y)=(\cos\alpha x-\sin\alpha y, \cos\alpha y+\sin\alpha x)$, if positive angles represent a counterclockwise rotation) and by $S$ the scaling operator
($S(x,y)=(K_x x,K_y y)$), then we have:
$$
\vec{P'P''}=\vec{P'O'}+\vec{O'O}+\vec{OP''}=
R\vec{PO'}+(S-1)\vec{OP}+R\vec{OP}=
-R(S\vec{OP})+(S-1)\vec{OP}+R\vec{OP},
$$
that is:
$$
\vec{P'P''}=
(S-1)\vec{OP}-R(S-1)\vec{OP}.
$$
Inserting here $\vec{OP}=(-L_x/2,L_y/2)$ one gets the desired result.
In comparing with my old formulas above, I see that
$\vec{P'P''}=(-\Delta x,-\Delta y)$.
In addition, I used there the opposite convention for the sign of the angle, but I hope this explanation is clear enough.
![enter image description here](https://i.stack.imgur.com/W09FL.png)
Best Answer
Composition of Euler angles is not simple.
Convert your Euler-angles to rotation matrices, and multiply them together.
Recover the angles
In your specific case, this evaluates to: