Multiple object properties assignment

You could use a direct approach by assigning the objects directly,

object.position = position;
object.rotation = rotation;

or with an array and the keys with iterating the properties.

['x', 'y', 'z'].forEach(function (k) {
    object.position[k] = position[k];
    object.rotation[k] = rotation[k];
});

Yes you can use Object.assign().

var obj = {}
var position = {x: 1, y: 2, z: 3}
var rotation = {x: 1, y: 2, z: 3}

obj.position = Object.assign({}, position);
obj.rotation = Object.assign({}, rotation);

console.log(obj)

If you only want to take specific properties from object you can create your pick function using map() to get array of objects and later use spread syntax to assign each object.

var obj = {}
var position = {x: 1, y: 2, z: 3}
var rotation = {x: 1, y: 2, z: 3}

function pick(obj, props) {
  return props.map(e => ({[e]: obj[e]}))
}

obj.position = Object.assign({}, ...pick(position, ['x', 'y']));
obj.rotation = Object.assign({}, ...pick(rotation, ['x', 'y', 'z']));

console.log(obj)


My advice: DON'T USE ANY "CLEVER" LOOPS AND DYNAMIC SH*T

Reasons:

  1. It's just a few lines, not a ton of lines, don't do overengineering
  2. It's so much readable, that even IDE can help you with autosuggestions