In some computational research about binary quadratic forms I recognized that the following fact holds for all my test forms:
Let $f(x,y) = ax^2 + by^2$ be a positive definite quadratic form, $M \in \mathbb{N}$ with $\Delta(f) = -4ab$ dividing $M$. Let $x_1,x_2$ be two units in $\mathbb{Z}/M\mathbb{Z}$. Then
$\vert\{(x,y) \in [0,M-1] \times [0,M-1]: ax^2 + by^2 \equiv x_1 \pmod M\}\vert$ = $\vert\{(x,y) \in [0,M-1] \times [0,M-1]: ax^2 + by^2 \equiv x_2 \pmod M\}\vert$
as long as those sets are not empty.
This does look like a quite standard number theoretic fact, but i could not find any proof or literature. Is this a known theorem?