Suppose $x\in\{a,b\}$ solve $x^2=m\bmod q$ and $y\in\{c,d\}$ solve $y^2=n\bmod q$ then when do all combinations of $xy\bmod q$ have same least non-negative residue?
Supposing we have $w\in\{e,f\}$ solve $w^2=m\bmod p$ and $z\in\{g,h\}$ solve $z^2=n\bmod p$ when do any combination of $wz\bmod p$ agree with any combination of $xy\bmod q$ at the least non-negative residue?
Okay so this is going to be a bit long winded but it'll have plenty of goodies for you to go through,
Problem statement: find conditions on $m,n,q$ such that solutions to $x^2 =m \mod q, y^2 = n \mod q$, $\lbrace a,b \rbrace$ and $\lbrace c,d \rbrace$ respectively have the property that $ac \equiv ad \equiv bc \equiv bd \mod q$
We will answer this in two phases:
Phase 1: $ac \equiv ad \mod q$
Now it's easy to see that $bc = bd$ yields the same conditions (with a swapped out by b) so we are ready to tackle the general thing:
Phase II: $ac \equiv ad \equiv bc \equiv bd$
that wraps up our conditions.