Based on code in this PR https://github.com/gliffy/canvas2svg/pull/36
The current code was going into an infinite loop It's also setting `patternUnits` to `userSpaceOnUse` in order to get the same behaviour as canvas patterns