Let $A$ and $B$ be two $n \times n$ full-rank matrices.

Let $XAY = B$ be the given equation where $X$ and $Y$ are unknown $n \times n$ matrices. We know that $Vec(B) = (Y^{T} \otimes X)Vec(A)$. Under what conditions can we determine $X$ and $Y$ and what would be the procedure to determine $X$ and $Y$?

Not looking for the obvious solutions such as $Y^{-1}=A$ and $X=B$, $A$ is the eigenvalue (or some multiple of eigenvalue) diagonal matrix of $B$ where $X$ and $Y$ diagonalizes $B$ and $A$ and $B$ are similar to $X$ and $Y$. In general are there any other possible choices that $Y^{T} \otimes X$ can take? These may be the only choices for general $A$ and $B$. However, given $A$ and $B$ are some other structured matrices, has such an equation been studied before?