Abbreviations: k: knit, sl1 pwise: slip1 stitch as if to purl, k2tog: knit 2 stitches together, psso: pass slipped stitch over stitch that was just worked & drop it off the needle.
To create a mitered square you are going to cast-on double the number of stitches you want one side of your square to be plus one stitch. For my square I cast-on 23 sts.
Even rows will be decrease rows and to do them you will take your total number of sts and subtract 3. For my square that would be 23-3=20. Next divide your # in half.
This will give you the number of sts before & after the decrease. So for my square it would be 10 sts, 3 sts for decrease, 10 sts.
You will keep repeating the below rows until you have 3 sts left on your needles. Row 1: Knit all sts, Row 2: k until st before dec, sl 1 st pwise, k2tog, psso, k remaining sts.