Get the position the mouse is over using ray-casting from the projected position of the camera/viewport.
Compare that position using GridMaps world_to_map(position)
Now you have a few options here
- Draw directly to the map using a
mesh_library
- Use an upward facing Quadmesh MeshInstance with a Texture
- Unproject Line2D or a CanvasItem's drawn Rect2D
- Use a shader like you mentioned
If you do decide to use a SpatialMaterial with an Albedo_Texture
like this
which is the easiest method. Ensure to enable Transparency