In this video I will explain how to rotate tilemap tiles in Godot using code.
The editor has buttons that allow you to rotate and mirror tiles when creating a tilemap, but this is more difficult when you need to modify your tilemap in the game at run time.
This video gives the code that I used to achieve this in my automation game.