performance: allow bounds to be specified so that we don't iterate over pixels that don't exist