Let $A$ be an $m \times n$ matrix such that $\mathrm{rank}(A) < n$. If one were to set the equation
\begin{equation*} A Z = B A, \end{equation*}
what is the condition that matrix $Z$ needs to fulfill such that the above relation is even possible? $Z$ is an $n \times n$ matrix.
Thank you!