Find all quadruples of positive integers ( $m, n, p, q$ ) with the property

$$
p^{m} q^{n}=(p+q)^{2}+1
$$
Lemma: If $k, l, a$ are positive integers with $a=\left(k^{2}+l^{2}+1\right) /(k l)$, then $a=3$. Proof of the lemma: For a given value of $a$, we consider a pair $(k, l)$ with $k^{2}+l^{2}+1=a k l$ and minimal sum $k+l$ among all such pairs. Without loss of generality, let $k \leq l$.
First, let $k<l$. By assumption, $k$ satisfies the quadratic equation

$$
x^{2}+l^{2}+1-a x l=0,
$$

for whose second solution $k^{\prime}$, Vieta's formulas give: $k+k^{\prime}=a l$ and $k k^{\prime}=l^{2}+1$. Thus, $k^{\prime}=a l-k$ is an integer, and since $k^{\prime}=\left(l^{2}+1\right) / k$ is positive, and because $k \geq l+1$ and $k k^{\prime}=l^{2}+1<(l+1)^{2}$, it follows that $k^{\prime} \leq l$, so $(l, k^{\prime})$ is a pair with a smaller sum $l+k^{\prime}<k+l$, contradicting the choice of $(k, l)$.
Thus, $k=l$, so $k^{2}(a-2)=1$, from which $k=1$ and $a=3$ follow.
Since $m \geq 1$ and $n \geq 1$, the expression $p^{m-1} q^{n-1}=\left(p^{2}+q^{2}+1\right) /(p q)+2$ is an integer, and by the lemma, $p^{m-1} q^{n-1}=5$, hence $p^{m-1}=1, q^{n-1}=5$ or $p^{m-1}=5, q^{n-1}=1$. In the first case, $n=2$ and $q=5 ; p$ satisfies the equation (1) for $l=5, a=3$ with solutions 2 and 13, and from $p^{m-1}=1$ it follows that $m=1$, and by substitution, we confirm the solution quadruples $(1,2,2,5)$ and $(1,2,13,5)$. The second case yields $(2,1,5,2)$ and $(2,1,5,13)$ accordingly.