This has proved to be a Tough Nut. Reading the article on Latin
Squares published in September 2002 should help you to solve this.
Taking $s=1$, $2$, $3$ or $4$ you can construct $4$ different Latin
squares $S^{i,j}$ of order $5$ where $S^{i,j}=si+j \pmod 5$.
Now suppose the numbers are used to denote the five ranks and
consider how many different arrangements there will be if no two
officers of the same rank or of the same regiment appear in the
same row or in the same column.