Rules and notation
Castling rights do not grow back
Once a rook moves, you cannot castle with that rook, even after it returns. A king move removes both rights. Moving one rook does not remove the right with the other.
Worked example
Position in text
White to move. White: rook a1, king e1, rook h1. Black: king e8.
FEN: 4k3/8/8/8/8/8/8/R3K2R w KQ - 0 1
From the diagram, play 1. Ra2 Ke7 2. Ra1 Ke8. The pieces return to their original squares, but White can now castle only kingside. Compare 1. Rh2 Ke7 2. Rh1 Ke8 instead: the same arrangement now permits only queenside castling.
A plausible mistake
Do not infer castling rights from a snapshot. Even an unmoved king and a rook on the starting square do not tell you whether that rook moved earlier or is a replacement rook.
Try it yourself
Start again from the diagram. White plays 1. Kf1 Ke7 2. Ke1 Ke8. Which rook can White castle with?
Check your answer
Neither. White’s king moved, losing both rights. The rooks stayed put, but that preserves nothing once the king moves.