Can you castle if the rook previously moved
No. 
In order to castle, the king and the rook involved in the move, must have never moved previously in the game.