javascript: click on an isometric plane and get the normal coordinates

I have photos distributed as cells. When I click, I get the corresponding row and column.
console.log ("Col:" + X + "Row:" + Y);

When applying an isometric view conversion like this:

ctx.translate (0, 300);
ctx.scale (1, 0.5);
ctx.rotate (-45 * Math.PI / 180);

I do not know what mathematical formula is applied to obtain the coordinates correctly.

Greetings.