sm1to0 function

Adapt spatial transformation matrix for 0-based indices.