See
go-containerregistry's
mutate.Rebase
instead.
That repo also contains code for a CLI to rebase container images, crane rebase
,
which is also described in more detail
here.
This package only exists as a thin wrapper around that functionality, which is much more flexible, and well-tested.