According to Wikipedia, one of the conditions of castling is:
The king and the rook must be on the same rank (Schiller 2003:19).
This is because of a loophole that would occur otherwise:
Without this additional restriction, it would be possible to promote a. pawn on the e-file to a rook and then castle vertically across the board (as long as the other conditions are met). This way of castling was "discovered" by Max Pam and used by Tim Krabbé in a chess puzzle before the FIDE rules were amended in 1972 to disallow it. See Chess Curiosities by Krabbé.
I understand this rule like this: Only the two original rooks (not promoted rooks) can partake in castling. Is there any loophole in this understanding of mine?