Consider the following three relations:
\begin{align} X &= Q\cos(\theta)^2 +R\sin(\theta)^2 \\ Y &= Q\sin(\theta)^2 +R\cos(\theta)^2\\ Z &= \cos(\theta)\sin(\theta)(R-Q) \end{align}
Can you find a relation $f$ such that $f(X,Y,Z)=0$ ?
$f$ can not depend explicitly on $Q,R,\theta$, however $f$ can be non linear in $(X,Y,Z)$.
\begin{align} X &= Q\cos(\theta)^2 +R\sin(\theta)^2 \tag{1}\label{1} \\ Y &= Q\sin(\theta)^2 +R\cos(\theta)^2 \tag{2}\label{2} \\ Z &= \cos(\theta)\sin(\theta)(R-Q) =\tfrac12\,\sin(2\theta)(R-Q) \tag{3}\label{3} . \end{align}
It follows from \eqref{1}, \eqref{2} that \begin{align} X+Y&=R+Q \tag{4}\label{4} ,\\ Y-X&= \cos(2\theta)(R-Q) \tag{5}\label{5} ,\\ 4Z^2+(Y-X)^2 &=(R-Q)^2 \tag{6}\label{6} , \end{align}
so we can express $Q,R$ in terms of $X,Y$ as
\begin{align} Q&= \tfrac12\,\Big(X+Y+\sqrt{4Z^2+(X-Y)^2}\Big) \tag{7}\label{7} ,\\ R&= \tfrac12\,\Big(X+Y-\sqrt{4Z^2+(X-Y)^2}\Big) \tag{8}\label{8} ,\\ \end{align}
Also, considering \eqref{1}, \eqref{2} as a linear system with $\cos^2\theta,\ \sin^2\theta,$ as two unknowns, we can find that
\begin{align} \cos^2\theta&= \frac{R\,Y-Q\,X}{R^2-Q^2} = \frac{R\,Y-Q\,X}{(X+Y)(R-Q)} \tag{9}\label{9} ,\\ \sin^2\theta&= \frac{Q\,Y-R\,X}{R^2-Q^2} = \frac{Q\,Y-R\,X}{(X+Y)(R-Q)} \tag{10}\label{10} , \end{align}
or
\begin{align} \cos^2\theta&= \frac12\,\left(1+\frac1{\sqrt{1+\frac{4Z^2}{(X-Y)^2}}}\right) \tag{11}\label{11} ,\\ \sin^2\theta&= \frac12\,\left(1-\frac1{\sqrt{1+\frac{4Z^2}{(X-Y)^2}}}\right) \tag{12}\label{12} . \end{align}