mapping function (data -> rect) that actually works