Character Movement won't work properly because of the rotation

So here is my current code :

	void Update()
	{
		
		if (myX != leftController.GetTouchPosition.x || myY != leftController.GetTouchPosition.y) { //checks if player changed position.
			myX = leftController.GetTouchPosition.x;
			myY = leftController.GetTouchPosition.y;

	        double rad = Mathf.Atan2(leftController.GetTouchPosition.y, leftController.GetTouchPosition.x); // In radians
			double deg = rad * (180 / System.Math.PI); // values from up right to up left : +0 to +180 and from down left to down right: -180 to -0

			double myRotAngle = 0;
			//calculating the specific angle in which the character should move
			if (deg < 0) {
				myRotAngle = 90 + ((deg * -1));
			} else if (deg >= 0 && deg <= 90)
				myRotAngle = 90 - deg;
			else if (deg >= 90 && deg <= 180)
				myRotAngle = 270 + (180 - deg);

			transform.localEulerAngles = new Vector3 (0f,(float)myRotAngle, 0f);//rotate
		
		}

		_rigidbody.MovePosition(transform.position + (transform.forward * leftController.GetTouchPosition.y * Time.deltaTime * speedMovements) +
			(transform.right * leftController.GetTouchPosition.x * Time.deltaTime * speedMovements) );//move
	}

So basically the problem is that when I want to rotate the character and move it the movement wont work properly as expected.
for example if I move my joystick down left my character moves up middle.

But If I only move the character without rotating him the character movement behaves as it should.

You’re applying the rotation to the character, but when you translate, you’re not respecting that rotation - instead going with the raw values off the controller. This makes transform.forward and transform.right constantly move along 0, 0, 1 and 1, 0, 0 respectively. In other words, your forward and right vectors never update their orientation with respect to your rotation. To fix this, use the rotation of the transform instead of your raw controller values in your translation statement, and you should be good to go. Keeping in mind you’re working with Vectors, you may simplify the statement:

// transform.right + transform.forward simplifies to (1, 0, 1) 
// This is the axis needed by the Quaternion driving the rotation, to test visually:
//    Create a cube in Unity
//    Set its position to 1, 0, 1
//    Rotate some degrees in Y
//    Drag the blue translation gizmo (the forward axis in Unity)
//    You will see that only the X and Z positions change, 
//    and it moves strictly along a ray pointed to by the blue arrow, 
//    which I think is the intended behaviour.
//        If you need to add controller input to control both axes, 
//        simply scale by the controller value:
//            (transform.forward * RawYAxisValue + transform.right * RawXAxisValue)

_rigidbody.MovePosition(transform.localRotation * transform.localPosition + (transform.right + transform.forward) * Time.deltaTime * speedMovements);