Using an electric knife, cut a 24-by-24-inch square of upholstery foam of the desired thickness.
Draw a diagonal line from bottom corner to top corner, creating a triangle, on both sides of the pillow.
Insert electric knife at either corner on one side and begin slicing, being sure to keep knife blade level. Turn foam around and cut into the other side.
Beginning at point B, gently pull and slice through the middle section where the knife blade did not reach, working your way in a straight line down to point A.
Trace the bottom, top, two sides and back onto cotton or flannel fabric, leaving a ½-inch seam allowance around each piece.
Sew the pieces together in the shape of the pillow, leaving back flap open at the bottom and sides. Turn under and sew raw edges on flap.
Insert foam pillow into cover through back flap.