Let θ be the acute angle shown.
Project the axis-aligned rectangle (with sides w and aw, where a is the aspect ratio) onto the directions of the sides of the rotated rectangle. Then, to fit, you need, simultaneously,
Hence, your desired width is limited to