Percentage size of the rectangle over the inner rectangle I need to know how much I need to zoom (in percent) the inner box to rotate the outer rectangle 12 degrees and he touched the inner rectangle with four sides on the perimeter.
For example, I have image 400x300px.
In this image in photoshop, I rotated inner rectangle 12 degrees and zoom width on 113%, and height on 126% (how see my eye).

 A: Let the inner rectangle be $W$ wide and $H$ high.  If you rotate by $\theta$ the leftmost triangle is $W \cos \theta, W\sin \theta, W$ and the bottom triangle is $H\cos \theta, H\sin \theta, H$  The outer rectangle is then $(W \cos \theta + H \sin \theta) \times (H \cos \theta + W \sin \theta)$, which in your case is $300 \cos 12 + 400 \sin 12 \times 400 \cos 12 + 300 \sin 12 \approx 376.6 \times 453.6$  Your eye gave $378 \times 452$, mighty close.
A: Let the smaller inner rectangle have dimensions $w \times h$ and let the bigger outer rectangle have dimensions $W \times H$. Now consider the bottom right right triangle in your diagram. Label its bottom side as $x$ and its right side as $y$. Then using basic trig, notice that:
\begin{align*}
x &= w\cos 12^\circ \\
y &= w\sin 12^\circ \\
W - x &= h\sin 12^\circ \\
H - y &= h\cos 12^\circ \\
\end{align*}
Combining, observe that you must zoom in the width and height by:
\begin{align*}
\frac{W}{w} &= \frac{w\cos 12^\circ + h\sin 12^\circ}{w} \\
\frac{H}{h} &= \frac{w\sin 12^\circ + h\cos 12^\circ}{h} \\
\end{align*}
Indeed, for the special case where $w = 400$ and $h = 300$, we obtain:
\begin{align*}
\frac{W}{w} &= \frac{400\cos 12^\circ + 300\sin 12^\circ}{400} \approx 113.41\% \\
\frac{H}{h} &= \frac{400\sin 12^\circ + 300\cos 12^\circ}{300} \approx 125.54\% \\
\end{align*}
