This is covered in Law 41 section 3. It states:
*If a protective helmet belonging to the fielding side is on the ground within the field of play, and the ball while in play strikes it, the ball shall become dead and, except in the circumstances of Law 34 (Hit the ball twice), 5 penalty runs shall then be awarded to the batting side, in addition to the penalty for a No ball or a Wide, if applicable.
Additionally runs completed by the batsmen before the ball strikes the protective helmet shall be scored, together with the run in progress if the batsmen had already crossed at the instant of the ball striking the protective helmet.
See Law 18.10 (Runs scored when the ball becomes dead other than at the fall of a wicket).*
This means that if the batsmen crossed for a run, they remain in their positions as of when the helmet was struck.
So, to answer your specific question, rotation does take place, if it's...