fixed a bug in rectWithOrientation