Steve's approach may be best for you. To better understand the approach using the compass, search the web/YouTube for "scribing". Personally, I'm big on cardboard templates. Very low-tech and somewhat time-consuming, you get a big piece of stiff cardboard from an art supply place and, using scissors and tape, make yourself a piece of cardboard that exactly fits your space. Trace that shape onto your board and make the cut with a jigsaw. Remember that jigsaw blades cut up, so to avoid tearout on the good side, you need to turn the piece upside down and trace onto the bottom.
Again, if your wall is straight, Steve's approach should work, otherwise scribing should work. Cardboard's more for when all else fails. It has the advantage of working perfectly, though. If you can see that your taped-up cardboard template fits the space, you know it's right.