I made the code as intuitive as possible, If you don't understand how it works, put it in the comments and I'll explain it to you. I can do the same with any shape using this code! Probably not the most eficcient way tho...