Consider two square integer matrices $X$ and $Y$ of the same dimension with the following properties:

$X^2=rX$, and $Y^2=sY$ for integers $r$ and $s$. The $\gcd$ of the entries of $X$ is 1 and the $\gcd$ of the entries of $Y$ is 1. In addition, there exists an invertible matrix $K$ such that $X^TK=KX$ and $Y^TK=KY$.

I am looking for the (possibly 'an') integer matrix $Z$ such that the range of $Z$ is the intersection of the ranges of $X$ and $Y$ and $Z^2=tZ$ for integer $t$. I am particularly interested in finding the smallest possible value of $t$.

What I have so far:

I *think* that the above properties of $X$ and $Y$ mean that the matrices $X/r$ and $Y/s$ are orthogonal projectors with respect to the metric $K$. If this is true, then the Anderson-Duffin formula says that $P=2\frac{X}{r}(\frac{X}{r}+\frac{Y}{s})^+\frac{Y}{s}$ is a projector onto the intersection of the ranges of $X$ and $Y$. $(\frac{X}{r}+\frac{Y}{s})^+$ indicates the psuedoinverse of $(\frac{X}{r}+\frac{Y}{s})$. If I knew the smallest integer by which I could multiply P and have an integer matrix, then that integer would be $t$ and I'd have $Z=tP$.

My guess is that $t$ will be something simple, like the $\gcd$ or $\rm{lcm}$ of $r$ and $s$, but I'm having trouble proving it, so I would appreciate any help.