It would still be a mile and you would still have swum it, so yes, it would count, unless you wanted to swim a mile of pure front crawl, in which case, no. There are keen types who like to swim butterfly by the mile and even one very keen lady who swam the English Channel with butterfly. Captain Webb swam it using breaststroke, also known as belly swimming in his day.

One of these days, I'd quite like to swim a 1500 meter race with breaststroke just to see how my time would compare, but my time with freestyle is so slow that it might be unkind to the officials, whose patience must be sorely tried already, although they never complain.