Perspective isn't defined until you also specify the placement and focal length of the imagined camera. In addition you obviously want to scale the image just like you scale photos taken by a real camera, you do not watch them in camera sensor size.
An alternative spec is to specify the imaging sector angle of the camera.
If the shape is rotated 30 degrees only around X axis with no other rotations and it's seen from very far away with a high zoom teleobjective you simply scale it vertically smaller, actually to cos(30 degrees) = 86,6%
This is a parallel projection. Rotation around Y axis means scaling in X direction to cos(rotation angle) and there's no interaction between those scalings.
The situation becomes complex, if the distance isn't especially long when compared to distance differences between camera and the corners. More complexity is caused if the camera watches somehow from up or down or from left or right. One technical person calculates a transformation matrix, another creates full 3D model with rendering.
An artist discards all numbers and distorts your image for a subjectively good appearance. That procedure is seemingly already well presented in other answers.
Used 2D warping must be adjusted to artistically good appearance.
Photoshop and Illustrator have 3D tools which can calculate the distortion like in a 3D program. You specify the rotation angles and camera's viewing sector angle. Without specifying things numerically, they finally are subjective tools like 2D Warping. A good point: The total effect of simultaneous numerically defined X and Y rotations will be consistent.
One method left is to make a perspective construction using traditional descriptive geometry methods. It's beyond the scope of this answer, but you can find something about it by checking this older case:
Rotating a square