Rotation works incorrectly for non-square 2D data

Pushing button Rotate in GUI data loader leads to incorrect data display and multiple warnings like

void QCPColorMapData::setCell(int, int, double) index out of bounds: