private void Rotate(Point position, double deltaX, double deltaY, Orientation orientation)
        {
            Point topRightGrid = GetCenterCoordinateOfFrameworkElement(TopRightRotationGrid);

            topRightGrid.X -= TopRightRotationGrid.Width / 2;
            topRightGrid.Y -= TopRightRotationGrid.Height / 2;

            m_RotationStartingPoint.X = topRightGrid.X + position.X;
            m_RotationStartingPoint.Y = topRightGrid.Y + position.Y;

            //System.Diagnostics.Debug.WriteLine("--------\nDeltaX: " + deltaX + ", DeltaY: " + deltaY);
            //System.Diagnostics.Debug.WriteLine("e.Position.X: " + position.X + ", e.Position.Y: " + position.Y);
            //System.Diagnostics.Debug.WriteLine("--------\nStarting Point: " + (m_rotationStartingPoint.X - deltaX) + ", " + (m_rotationStartingPoint.Y - deltaY));
            //System.Diagnostics.Debug.WriteLine("Position: " + m_rotationStartingPoint.X + ", " + m_rotationStartingPoint.Y);

            //var transform = AreaToDrawGrid.TransformToVisual(GridMainSelection);
            //Point absolutePosition = transform.TransformPoint(new Point(0, 0));

            //absolutePosition.X += AreaToDrawGrid.Width / 2;
            //absolutePosition.Y += AreaToDrawGrid.Height / 2;

            // TODO: check if translation of X & Y should be addeds

            Point centerPoint = GetCenterCoordinateOfGridMain();

            double previousXLength = m_RotationStartingPoint.X - deltaX - centerPoint.X;
            double previousYLength = m_RotationStartingPoint.Y - deltaY - centerPoint.Y;
            double currentXLength  = m_RotationStartingPoint.X - centerPoint.X;
            double currentYLength  = m_RotationStartingPoint.Y - centerPoint.Y;

            //previousXLength *= -1;
            //previousYLength *= -1;
            //currentXLength *= -1;
            //currentYLength *= -1;

            //    double previousXLength = mPreviousEventCoordinate.x - deltaX - mToolPosition.x;
            //    double previousYLength = mPreviousEventCoordinate.y - deltaY - mToolPosition.y;
            //    double currentXLength = currentPoint.x - mToolPosition.x;
            //    double currentYLength = currentPoint.y - mToolPosition.y;

            double rotationAnglePrevious = Math.Atan2(previousYLength, previousXLength);
            double rotationAngleCurrent  = Math.Atan2(currentYLength, currentXLength);
            double deltaAngle            = -(rotationAnglePrevious - rotationAngleCurrent);

            m_RotationAngle += (float)PocketPaintApplication.RadianToDegree(deltaAngle) + 360;
            m_RotationAngle %= 360;

            //if (orientation == Orientation.Left)
            //{
            //    m_rotation = m_rotation * -1;
            //}

            if (m_RotationAngle > 180)
            {
                m_RotationAngle = m_RotationAngle - 360;
            }

            //while (m_rotation < 0)
            //{
            //    m_rotation += 360;
            //}

            var rt = new RotateTransform
            {
                Angle   = m_RotationAngle,
                CenterX = m_CenterPointRotation.X,
                CenterY = m_CenterPointRotation.Y
            };

            addTransformation(rt);

            // Paintroid code:
            //private void rotate(float deltaX, float deltaY) {
            //    if (mDrawingBitmap == null) {
            //        return;
            //    }

            //    PointF currentPoint = new PointF(mPreviousEventCoordinate.x, mPreviousEventCoordinate.y);

            //    double previousXLength = mPreviousEventCoordinate.x - deltaX - mToolPosition.x;
            //    double previousYLength = mPreviousEventCoordinate.y - deltaY - mToolPosition.y;
            //    double currentXLength = currentPoint.x - mToolPosition.x;
            //    double currentYLength = currentPoint.y - mToolPosition.y;

            //    double rotationAnglePrevious = Math.atan2(previousYLength, previousXLength);
            //    double rotationAngleCurrent = Math.atan2(currentYLength, currentXLength);
            //    double deltaAngle = -(rotationAnglePrevious - rotationAngleCurrent);

            //    mBoxRotation += (float) Math.toDegrees(deltaAngle) + 360;
            //    mBoxRotation = mBoxRotation % 360;
            //    if (mBoxRotation > 180)
            //        mBoxRotation = -180 + (mBoxRotation - 180);
            //}

            // Previous Pocket Paint code:
            //    rotateCenterPoint.X = PocketPaintApplication.GetInstance().RectangleSelectionControl.MainGrid.Width / 2.0;
            //    rotateCenterPoint.Y = PocketPaintApplication.GetInstance().RectangleSelectionControl.MainGrid.Height / 2.0;

            //    rotate.CenterX = rotateCenterPoint.X;
            //    rotate.CenterY = rotateCenterPoint.Y;

            //    Point centerPoint = PocketPaintApplication.GetInstance().RectangleSelectionControl.getCenterCoordinateOfGridMain();

            //    if (!(lastPoint.X == 0.0 && lastPoint.Y == 0.0) &&
            //        (lastPoint.X != point.X || lastPoint.Y != point.Y))
            //    {
            //        double currentXLength = point.X - centerPoint.X;
            //        double currentYLength = point.Y - centerPoint.Y;
            //        double normalCurrentX = currentXLength / (Math.Sqrt(currentXLength * currentXLength + currentYLength * currentYLength));
            //        double normalCurrentY = currentYLength / (Math.Sqrt(currentXLength * currentXLength + currentYLength * currentYLength));

            //        double previousXLength = lastPoint.X - centerPoint.X;
            //        double previousYLength = lastPoint.Y - centerPoint.Y;
            //        double normalPreviousX = previousXLength / (Math.Sqrt(previousXLength * previousXLength + previousYLength * previousYLength));
            //        double normalPreviousY = previousYLength / (Math.Sqrt(previousXLength * previousXLength + previousYLength * previousYLength));

            //        double deltaAngle = (Math.Atan(normalPreviousX / normalPreviousY) - Math.Atan(normalCurrentX / normalCurrentY));
            //        double rotationAngle = deltaAngle * 360.0 / Math.PI;

            //        rotate.Angle = rotationAngle;
            //    }
        }