Vertical castling is not considered a legal move in chess tournaments, because the rook has to be “on the same rank” as the king to castle.
According to the former (FIDE) rules, castling was allowed when:
Neither the King nor the Rook have been moved
There is no other piece between the King and the Rook
The king does not pass through a square that is attacked by an enemy piece
The king is not in check before or after castling
So it was the Danish chess composer C. Staugaard who found a gap in these rules and published the following chess problem!
C. Staugaard, 1907
White mates in 2