After browsing the web and reading dozens of examples and tutorials I still can't figure out how to translate mouse X;Y screen position in pixels to X;Y isometric tile index. All the examples I tried returned strange values.

The attached picture shows exactly the tiles' redering order. The Zig-Zag rendering mode was so simple to implement with the help of a colored coded tile. But this diamond shapped design is really giving me a hard time.

I guess the formula involves the following variables:

- MousePos.X

- MousePos.Y

- TileWidth

- TileHeight

- ScreenWidth

- ScreenHeight

Now I just need to know how to put the pieaces the together as I really can't see any logic behind it.

Thank you very much for any possible help.