Add device_to_data coordinate conversion

This is useful for GUIs, where mouse-clicks have to be
interpreted in terms of data coordinates.