Prevent object from rotating through rigidbody?

I have a maze game. The player controls the x and z rotations of the board.

My code:

if(Input.GetKey("w"))  {
			
			transform.Rotate(Time.deltaTime*10, 0, 0);
			
		}
		
		if(Input.GetKey("a"))  {
			
			transform.Rotate(0, 0, Time.deltaTime*-10);
			
		}
		
		if(Input.GetKey("s"))  {
			
			transform.Rotate(Time.deltaTime*-10, 0, 0);
			
		}
		
		if(Input.GetKey("d"))  {
			
			transform.Rotate(0, 0, Time.deltaTime*10);
			
		}

My problem is, when the board rotates, it rotates into the sphere, so the sphere doesn’t roll.

Yes the sphere is a rigidbody, and yes, all of the cubes that comprise the board have box colliders.

Help please?

I think this code will help you …
var target : Transform;
x += Input.GetAxis(“Mouse X”) * xSpeed * 0.01;
y -= Input.GetAxis(“Mouse Y”) * ySpeed * 0.01;
y = ClampAngle(y, yMinLimit, yMaxLimit);
var rotation = Quaternion.Euler(y, x, 0);
target.transform.rotation = rotation;