New rules.
Returns name of new filename after deduping.
Working recursive version.  Unfortunately, the stack depth is only 1000 so it works at 5 pixel resolution instead of 1.