If `iterations` were a large value, this recursion would create a lot of copies of the mask, but I don't think this problem is relevant in the usecases of this function.