sm0to1 function

Adapt spatial transformation matrix for 1-based indices.