The point $X$ moves around inside a rectangle of dimension $p$ units by $q$ units. The distances of $X$ from the vertices of the rectangle are $a$, $b$, $c$ and $d$ units. What are the least and the greatest values of
$a^2 + b^2 + c^2 + d^2$
and where is the point $X$ when these values occur?