Rewriting in categories of spans