user21713: It is my understanding that a castling move cannot occur if the king / rook moved. However, in the case where a rook and king move but end up in their original spots, can a castling move occur?

user10210: The answer is NO. Neither the King nor the Rook on the side you want to castle should not had moved previously AND there is one important fact, the Rooks should be on the initial position rank!
There were some lacks in rules of castling in chess history and some people made fun of this by creating funny joke puzzles like this one:

An example was composed by Tim Krabbé and relied on a loophole that existed in the definition of castling. In the diagram, White must mate in three moves. The solution begins 1. e7, then the main variations are:
1... Kd3 2. e8=Q gxf3 (other moves allow Qe2#) 3. 0-0-0#
1... Kxf3 2. e8=R! (an underpromotion), and now:
2... d4 3. 0-0#
2... Kg2 3. 0-0-0-0#!
In the last variation, White castles with his newly promoted rook, moving his king to e3 and the rook to e2. Under the rules of chess at the time, this move was arguably legal because the rook had not moved yet. Afterward, FIDE amended the rules to require that the castling rook must occupy the same rank as the king
https://en.wikipedia.org/wiki/Joke_chess_problem

user19877: Sorry, no. Once either has moved, it can no longer be involved in castling. An unmoved king, and the other unmoved rook can still castle.

21713: <p>It is my understanding that a castling move cannot occur if the king / rook moved. However, in the case where a rook and king move but end up in their original spots, can a castling move occur?</p>
 10210: <p>The answer is NO. Neither the King nor the Rook on the side you want to castle should not had moved previously AND there is one important fact, the Rooks should be on the initial position rank!</p>
<p>There were some lacks in rules of castling in chess history and some people made fun of this by creating funny joke puzzles like this one:</p>
<p><a href="https://i.stack.imgur.com/TxE4z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TxE4z.png" alt="enter image description here" /></a></p>
<p>An example was composed by Tim Krabbé and relied on a loophole that existed in the definition of castling. In the diagram, White must mate in three moves. The solution begins 1. <strong>e7,</strong> then the main variations are:</p>
<p><strong>1... Kd3 2. e8=Q gxf3 (other moves allow Qe2#) 3. 0-0-0#<br></strong>
<strong>1... Kxf3 2. e8=R! (an underpromotion), and now:<br></strong>
<strong>2... d4 3. 0-0#<br></strong>
<strong>2... Kg2 3. 0-0-0-0#!<br></strong></p>
<p>In the last variation, White castles with his newly promoted rook, moving his king to e3 and the rook to e2. Under the rules of chess at the time, this move was arguably legal because the rook had not moved yet. <strong>Afterward, FIDE amended the rules to require that the castling rook must occupy the same rank as the king</strong></p>
<p><a href="https://en.wikipedia.org/wiki/Joke_chess_problem" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Joke_chess_problem</a></p>
 19877: <p>Sorry, no. Once either has moved, it can no longer be involved in castling. An unmoved king, and the other unmoved rook can still castle.</p>
