The way I did it was to measure the mattress, add a couple of inches to both width and length for the sides and seam allowance/casing and then cut a rectangle that size. I then cut squares out of each corner (small squares - just from sides and seam allowance/casing ).

Sew the corners - you'll be sewing two adjacent sides of the square together. Then make a narrow casing around the entire thing and insert 1/8 or 1/4" elastic.

HTH