I've been in Dubai some time ago and in a Starbucks I've found square donuts.
Can you explain why? Is there a religious rule?
I think that is just for aesthetical reasons.
There are stores in Dubai that do sell round doughnuts, such as Dunkin Donuts, Krispy Kreme or other stores, the only reference to square doughnuts in Dubai that I could find was the ones at Starbucks.
Also on the other hand there are square doughnuts for instance in the US, without any mention to it be for any religious or cultural reason. According to this Time article, they started producing it for purely practical reasons:
Square Donuts in Indianapolis started making boxy doughnuts kind of by accident, when the manufacturer of its doughnut cutters gave a square cutter to Rich Comer, the store’s founder.