Retargeting fails if avatar mesh is rotated

It’s probably the same problem as here:

The rest pose must be exactly the same for the animation and the mesh for retargeting to work as expected.