rotate_copy algorithm and test

Algorithm and test for the rotate_copy algorithm