The black rooks in the diagram are obviously promoted, and the white bishops were obviously captured at home (by knights, if we like). Black played axX(b1)=R on his last move. The five white pieces that could have been captured are both knights and rooks, and the queen. There were two captures on a2, one final capture on b1, and at least one capture on the b-file. Pb4 ensures that there were two captures on the b-file. If it is the original b-pawn, then the a- and c-pawns captured on the b-file. If not, then it is either the a- or c-pawn, and the other also captured on the b-file and got promoted. Thus there were five white units (among them both rooks) captured by the pawns. One rook could have played Ra1-a2 to be captured, but the other could not, and was thus captured on b1. So the last move was axRb1=R. If white did not castle king-side, then the king must have escaped via a2 to allow Rh1-a1. But getting back in would be impossible. WRa2/WRa1 would prevent K-a2-b1? and so would BRa1. So the only possibility is for Rh1 to move “through” the king by castling.
The black rooks in the diagram are obviously promoted, and the white bishops were obviously captured at home (by knights, if we like). Black played axX(b1)=R on his last move. The five white pieces that could have been captured are both knights and rooks, and the queen. There were two captures on a2, one final capture on b1, and at least one capture on the b-file. Pb4 ensures that there were two captures on the b-file. If it is the original b-pawn, then the a- and c-pawns captured on the b-file. If not, then it is either the a- or c-pawn, and the other also captured on the b-file and got promoted. Thus there were five white units (among them both rooks) captured by the pawns. One rook could have played Ra1-a2 to be captured, but the other could not, and was thus captured on b1. So the last move was axRb1=R. If white did not castle king-side, then the king must have escaped via a2 to allow Rh1-a1. But getting back in would be impossible. WRa2/WRa1 would prevent K-a2-b1? and so would BRa1. So the only possibility is for Rh1 to move “through” the king by castling.